Telegram Group & Telegram Channel
​​Разница между == и is

Недавно в чате наши подписчики затрагивали эту тему, поэтому мы решили разложить всё по полочкам, чтобы в дальнейшем не возникало вопросов.

Итак, оператор == проверяет равенство значений двух объектов. А оператор is в свою очередь проверяет идентичность самих объектов. Его используют, чтобы удостовериться, что переменные указывают на один и тот же объект в памяти.

Однако Python в целях производительности кеширует короткие строки и малые целые числа, поэтому возможны некоторые казусы, как в примере.



tg-me.com/python_academy/64
Create:
Last Update:

​​Разница между == и is

Недавно в чате наши подписчики затрагивали эту тему, поэтому мы решили разложить всё по полочкам, чтобы в дальнейшем не возникало вопросов.

Итак, оператор == проверяет равенство значений двух объектов. А оператор is в свою очередь проверяет идентичность самих объектов. Его используют, чтобы удостовериться, что переменные указывают на один и тот же объект в памяти.

Однако Python в целях производительности кеширует короткие строки и малые целые числа, поэтому возможны некоторые казусы, как в примере.

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/64

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Dump Scam in Leaked Telegram Chat

A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless “$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.

In many cases, the content resembled that of the marketplaces found on the dark web, a group of hidden websites that are popular among hackers and accessed using specific anonymising software.“We have recently been witnessing a 100 per cent-plus rise in Telegram usage by cybercriminals,” said Tal Samra, cyber threat analyst at Cyberint.The rise in nefarious activity comes as users flocked to the encrypted chat app earlier this year after changes to the privacy policy of Facebook-owned rival WhatsApp prompted many to seek out alternatives.Python Academy from cn


Telegram Python Academy
FROM USA